import {createRouter, createWebHistory} from 'vue-router';
import Layout from '@/views/Layout/index.vue';
import Home from '@/views/Home/index.vue';
import Careers from '@/views/Careers/index.vue';
import Games from '@/views/Games/index.vue';
import AboutUs from '@/views/AboutUs/index.vue';
import News from "@/views/AboutUs/components/news/News.vue";
import News01 from "@/views/AboutUs/components/news/News01.vue";
import News02 from "@/views/AboutUs/components/news/News02.vue";
import BrawlStars from '@/views/Games/components/brawlstars/index.vue';
import HayDay from '@/views/Games/components/hayday/index.vue';
import ClashRoyale from '@/views/Games/components/clashroyale/index.vue';
import BoomBeach from '@/views/Games/components/boombeach/index.vue';
import ClashOfClans from '@/views/Games/components/clashofclans/index.vue';
import CommonNews from "@/views/AboutUs/components/CommonNews.vue";
import WhyYouMightLoveItHere from '@/views/Careers/components/whyYou/index.vue'
import OurOffices from '@/views/Careers/components/ourOffices/index.vue'
import JoiningSupercell from '@/views/Careers/components/joining/index.vue'


const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [{
        path: '/',
        component: Layout,
        children: [{
            path: '',
            component: Home
        }, {
            path: 'games',
            children: [
                {
                    path: '',
                    component: Games
                }, {
                    path: 'brawlstars',
                    component: BrawlStars
                }, {
                    path: 'hayday',
                    component: HayDay
                }, {
                    path: 'clashroyale',
                    component: ClashRoyale
                }, {
                    path: 'boombeach',
                    component: BoomBeach
                }, {
                    path: 'clashofclans',
                    component: ClashOfClans
                }
            ]
        }, {
            path: 'careers',
            children: [
                {
                    path: '',
                    component: Careers,
                }, {
                    path: 'why-you-might-love-it-here',
                    component: WhyYouMightLoveItHere
                }, {
                    path: 'our-offices',
                    component: OurOffices
                }, {
                    path: 'joining-supercell',
                    component: JoiningSupercell
                }
            ]
        }, {
            path: 'about-us',
            children: [{
                path: '',
                component: AboutUs
            }, {
                path: 'news',
                component: News
            }]
        }, {
            name: '/about-us/news/001',
            path: '/about-us/news/001',
            component: News01
        }, {
            name: '/about-us/news/002',
            path: '/about-us/news/002',
            component: News02
        }, {
            name: 'commonNews',
            path: '/about-us/news/common/:commonTitle?/:category?/:date?/:pic?/:content?',
            component: CommonNews,
            props: true
        }]
    },], scrollBehavior(to, from, savedPosition) {
        // 始终滚动到顶部
        return {top: 0}
    }
})

export default router
